//	ID : pallab81
// 	PROG : MKBUDGET
// 	LANG : C++
// 	2011-06-29-17.01.41 Wednesday
//
// 	"I have not failed, I have just found 10000 ways that won't work.
//


#include <iostream>
#include <algorithm>
#include <vector>
#include <sstream>
#include <fstream>
#include <string>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>

#include <cstdio>
#include <cmath>
#include <cstring>
#include <climits>
#include <cstring>

using namespace std;

#define  CI( x ) scanf( "%d", &x )

#define VI vector<int>
#define VVI vector<VI >
#define VS vector<string>
#define VC vector<char>
#define VVC vector<VC >
#define VB vector<bool>
#define VVB vector<VB >
#define PAIR pair<int,int>
#define VP vector<PAIR >
#define fo(i,st,ed) for(int i = st; i < ed ; ++i)
#define foE(i,st,ed) for(int i = st; i <= ed ; ++i)
#define foit(i, x) for (typeof((x).begin()) i = (x).begin(); i != (x).end(); i++)
#define bip system("pause")
#define mk make_pair
#define f first
#define s second
#define pb push_back
#define SZ(X) (int)(X).size()
#define LN(X) (int)(X).length()
#define ll long long
#define IO ifstream cin(".in") ; ofstream cout(".out");

int num_of_month;
int employee_needs[ 30 ];
int company_pabe, company_dibe, bad_dite_khoroch;
int remember[ 30 ][ 100000 ];
int max_need;

inline bool read() {
    scanf("%d",&num_of_month);
    if(num_of_month==0)return false;
    CI(company_pabe);
    CI(company_dibe);
    CI(bad_dite_khoroch);

    max_need=0;
    foE(i,1,num_of_month) {
        scanf("%d",&employee_needs[i]);
        max_need = max(employee_needs[i],max_need);
    }
    return true;
}
inline void proc(int cases) {
    memset( remember, 0, sizeof(remember) );
    int month, employee;
    for( month = 1; month <= num_of_month; ++month ) {
        if(month==1) {
            for( employee = employee_needs[month]; employee <= max_need; ++employee ) {
                int company_recieve = company_pabe*employee;
                int total_salary    = company_dibe*employee;
                int to_pay          = 0;//array[2]*employee_needs[month];

                int company_bay = company_recieve+total_salary+to_pay;
//                    cout<<employee<<" "<<month<<" : ";
//                    cout<<company_recieve<<" "<<total_salary<<" "<<to_pay<<" "<<company_bay<<"\n";bip;
                remember[month][ employee ] = company_bay;
            }
        } else if(month!=num_of_month) {
            for( employee = max_need; employee >= employee_needs[ month] ; --employee ) {
                int optimal = (int)1023456789;
                for( int temp_employee = employee_needs[month-1] ; temp_employee <= max_need ; ++temp_employee) {
                    int company_recieve = company_pabe*( employee > temp_employee ? employee-temp_employee : 0 );
                    int total_salary    = company_dibe*( employee );
                    int to_pay = bad_dite_khoroch*( employee < temp_employee ? temp_employee - employee : 0 );
                    int company_bay = company_recieve+total_salary+to_pay;
                    int total = company_bay+remember[ month-1 ][ temp_employee ];
//
//                                cout<<employee<<" "<<month<<" "<<temp_employee<<" : ";
//                                cout<<company_recieve<<" "<<total_salary<<" "<<to_pay<<" "<<company_bay<<"\n";bip;
                    optimal = min( optimal ,total );
                }
                remember[ month ][ employee ] = optimal;
                // cout<<employee<<" "<<month<<" "<<remember[month][employee]<<"\n";bip;
            }
        } else {
            for( employee = max_need; employee >= employee_needs[ month] ; --employee ) {
                int optimal = (int)1023456789;
                for( int temp_employee = employee_needs[month-1] ; temp_employee <= max_need ; ++temp_employee) {
                    int company_recieve = company_pabe*( employee > temp_employee ? employee-temp_employee : 0 );
                    int total_salary    = company_dibe*( employee );
                    int to_pay = 0;//bad_dite_khoroch*( employee < temp_employee ? temp_employee - employee : 0 );
                    int company_bay = company_recieve+total_salary+to_pay;
                    int total = company_bay+remember[ month-1 ][ temp_employee ];

//                                cout<<employee<<" "<<month<<" "<<temp_employee<<" : ";
//                                cout<<company_recieve<<" "<<total_salary<<" "<<to_pay<<" "<<company_bay<<"\n";bip;
                    optimal = min( optimal ,total );
                }
                remember[ month ][ employee ] = optimal;
                //    cout<<employee<<" "<<month<<" "<<remember[month][employee]<<"\n";bip;
            }
        }
    }
    printf("Case %d, cost = $%d\n",cases, remember[ num_of_month ][ employee_needs[num_of_month] ]);
}

int main() {
    int cases;
    for(cases=1; read()==true ; ++cases) {
        proc(cases);
    }
    return 0;
}

